package com.itouch.bracelet.adapter;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.itouch.bracelet.R;
import com.itouch.bracelet.bean.RGroup;


public class RGroupAdapter extends BaseAdapter {

	private List<RGroup> list;
	private LayoutInflater mInflater;
	private Context context;
	public RGroupAdapter(Context context, List<RGroup> list) {
		this.list= list;
		this.context=context;
		this.mInflater = LayoutInflater.from(context);
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return list.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View view, ViewGroup parent) {
		HoldView mHoldView = null;
		if (view == null) {
			mHoldView = new HoldView();
			view = mInflater.inflate(R.layout.adapter_item_imgroup,
					null);
			mHoldView.item1 = (TextView) view
					.findViewById(R.id.item1);
			view.setTag(mHoldView);
		} else {
			mHoldView = (HoldView) view.getTag();
		}
		final RGroup a = list.get(position);
		mHoldView.item1 .setText(a.getGroupName());
		return view;
	}

	class HoldView {
		public TextView item1 ;
//		public TextView item2 ;
//		public TextView item3 ;
//		public TextView item4;
	}
}
